export function toRouter(menus, packageName) {
  for (let i = 0; i < menus.length; i++) {
    const menu = menus[i]
      if (packageName) { //子集
        const path = menu.component
        if(path){
          menu.component = () => Promise.resolve(require(`@/views/${packageName}/${path}/index`))
        }else {
          menu.component = () => Promise.resolve(require(`@/views/${packageName}/index`))
        }

        // menu.component = () => import('@/views/sys/menu/index')
      } else {
        menu.component = () => Promise.resolve(require('@/layout'))
      }
    menu.meta = { title: menu.name, icon: menu.icon }
    if (menu.children && menu.children.length > 0) {
      toRouter(menu.children, menu.path.replace('/', ''))
    }
  }
  // return menus
}
